package controllers;

import helpers.GoogleStorageHelper;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class HomeServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		
		//response.getWriter().println(request.getRemoteAddr());
		
		/*String content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
		content += "<hoanbn>Hello the word</hoanbn>";
		String filename = "api/hoanbn.xml";
		
		GoogleStorageHelper.saveFileXML(content.getBytes(), filename);*/
		
		response.setContentType("text/plain");
		String url = "/gs/static.hatforrent.com/api/JE4V57MS6I1385525911922.txt";
		response.getWriter().println(GoogleStorageHelper.readFileGoogleStorage(url));
		
	}
}
